/*
 *  Copyright (C) 2006 Takeharu KATO
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#if !defined(PROTOCOL_H)
#define PROTOCOL_H
#include "udp.h"
long ipmsg_get_pkt_no(void);
int ipmsg_send_release_files(const udp_con_t *con,const char *ipaddr,int pktno);
int ipmsg_send_br_isgetlist2(const udp_con_t *con,const int flags);
int ipmsg_send_br_entry(const udp_con_t *con,const int flags);
int ipmsg_send_ans_entry(const udp_con_t *con,const int flags);
int ipmsg_send_gratuitous_ans_entry(const udp_con_t *con, const char *ipaddr, const int flags);
int ipmsg_send_br_exit(const udp_con_t *con,const int flags);
int ipmsg_proc_br_absence(const udp_con_t *con,const msg_data_t *msg);
int ipmsg_send_br_absence(const udp_con_t *con,const int flags);
int ipmsg_send_recv_msg(const udp_con_t *con,const msg_data_t *orig_msg);
int ipmsg_send_read_msg(const udp_con_t *con,const char *ipaddr,int pktno);
int ipmsg_send_send_msg(const udp_con_t *con,const char *ipaddr,int flags,int pktno,const char *message,const char *ext_part);
int ipmsg_dispatch_message(const udp_con_t *con,const msg_data_t *msg);
int ipmsg_construct_getfile_message(unsigned long ftype,const char *msg_string,int flags,size_t *len,char **msg,long pktno);
int ipmsg_send_broad_cast(const udp_con_t *con,const char *msg,size_t len);
int ipmsg_send_get_info_msg(const udp_con_t *con,const char *ipaddr,unsigned long command);
int ipmsg_send_getpubkey(const udp_con_t *con,const char *ipaddr);
#endif
